<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1">
	<meta charset="UTF-8">
	<title>移动支付管理系统</title>
	<link rel="stylesheet" type="text/css" href="<c:url value='/script/jquery-easyui-1.5.2/themes/default/easyui.css'/>">
	<link rel="stylesheet" type="text/css" href="<c:url value='/script/jquery-easyui-1.5.2/themes/icon.css'/>"> 
	<link rel="stylesheet" type="text/css" href="<c:url value='/script/ztree/css/zTreeStyle/zTreeStyle.css?v=1'/>">
	<style type="text/css">
		table td{padding: 5px}
	</style>
	<script type="text/javascript" src="<c:url value='/script/jquery.min.js'/>"></script>
	<script type="text/javascript" src="<c:url value='/script/jquery-easyui-1.5.2/jquery.easyui.min.js'/>"></script>
	<script type="text/javascript" src="<c:url value='/script/jquery-easyui-1.5.2/easyuiMain.js'/>"></script>
	<script type="text/javascript" src="<c:url value='/script/jquery-easyui-1.5.2/locale/easyui-lang-zh_CN.js'/>"></script>
	<script type="text/javascript" src="<c:url value='/script/ztree/js/jquery.ztree.core-3.5.js'/>"></script>
	<script type="text/javascript" src="<c:url value="/script/jiepos.js"/>"></script>
	<script type="text/javascript" src="<c:url value="/script/jpvalidate.js"/>"></script>

    <script type="text/javascript">	     
		$(function(){
			var setting = {
					data: {
						key: {name: "name"},
						simpleData:{enable: true, idKey: "id", pIdKey: "pid"}
					},
					callback: {
						beforeClick: beforeClick,
						onClick: treeOnClick
					}
			};
// 			$.fn.zTree.init($("#treeDemo"), setting, zNodes);
			$.ajax({
				url: "${pageContext.request.contextPath}/menucode/getMenuTreeByRoleUuid.do",
				async: false,
				success: function(data){
					$.fn.zTree.init($("#treeDemo"), setting, data);
				}
			});
		});
		function beforeClick(treeId, treeNode, clickFlag) {
		  
		}
		function treeOnClick(event, treeId, treeNode, clickFlag) {
			var tabTitle = treeNode.name;
			var url = treeNode.url;
			if(!url){
				return;
			}
			if(url.indexOf("?") != -1){
				url += "&menuCode=" + treeNode.id;
			}else{
				url += "?menuCode=" + treeNode.id;
			}
			addTab(tabTitle, "${pageContext.request.contextPath}/" + url);
		}
		
	    $.fn.panel.defaults.onBeforeDestroy = function() {/* 回收内存 */
			var frame = $('iframe', this);
			if (frame.length > 0) {
				frame[0].contentWindow.document.write('');
				frame[0].contentWindow.close();
				frame.remove();
				if ($.browser.msie) {
					CollectGarbage();
				}
			}
		};
		$.fn.panel.defaults = $.extend({},$.fn.panel.defaults,{onBeforeDestroy:function(){  
	        $(this).find(".combo-f").each(function () {  
	            var panel = $(this).data().combo.panel;  
	            panel.panel("destroy");  
	        });  
	    }  
	});  
		
		/**
		 *
		 * @requires jQuery,EasyUI
		 *
		 * 防止panel/window/dialog组件超出浏览器边界
		 * @param left
		 * @param top
		 */
		var easyuiPanelOnMove = function(left, top) {
		    var l = left;
		    var t = top;
		    if (l < 1) {
		        l = 1;
		    }
		    if (t < 1) {
		        t = 1;
		    }
		    var width = parseInt($(this).parent().css('width')) + 14;
		    var height = parseInt($(this).parent().css('height')) + 14;
		    var right = l + width;
		    var buttom = t + height;
		    var browserWidth = $(window).width();
		    var browserHeight = $(window).height();
		    if (right > browserWidth) {
		        l = browserWidth - width;
		    }
		    if (buttom > browserHeight) {
		        t = browserHeight - height;
		    }
		    $(this).parent().css({/* 修正面板位置 */
		        left : l,
		        top : t
		    });
		};
		$.fn.dialog.defaults.onMove = easyuiPanelOnMove;
		$.fn.window.defaults.onMove = easyuiPanelOnMove;
		$.fn.panel.defaults.onMove = easyuiPanelOnMove;
	</script>
</head>
<body class="easyui-layout" style="overflow-y: hidden"  scroll="no">
	<noscript>
	<div style=" position:absolute; z-index:100000; height:2046px;top:0px;left:0px; width:100%; background:white; text-align:center;">
	    <img src="images/noscript.gif" alt='抱歉，请开启脚本支持！' />
	</div>
	</noscript>
    <div region="north" split="true" border="false" style="overflow: hidden; height: 60px;
        background: url(images/layout-browser-hd-bg.gif) #7f99be repeat-x center 50%;
        line-height: 50px;color: #fff; font-family: Verdana, 微软雅黑,黑体">
        <span style="float:right; padding-right:20px;" class="head">
        	<c:if test="${ROLE_NAME != null && USER_NAME != null}">
	        	欢迎【<c:out value="${ROLE_NAME} - ${USER_NAME}"></c:out>】
        	</c:if>
        	<a href="javascript:;" id="editpass" style="color:#FFFFFF">修改密码</a>
        	<a href="javascript:;" id="loginOut" style="color:#FFFFFF">安全退出</a>
        </span>
        <span style="padding-left:10px; font-size: 19px; ">
        	<!-- <img src="images/blocks.gif" width="20" height="20" align="absmiddle" /> -->
        	<c:if test="${INS_CN_NM != null}">
	        	<c:out value="${INS_CN_NM}"></c:out>
        	</c:if> 
        </span>
    </div>
    <div region="south" split="true" style="height: 30px; background: #D2E0F2; ">
        <div class="footer">江苏杰博实信息技术有限公司版权所有</div>
    </div>
    <div region="west" split="true" title="系统菜单" style="width:210px;" id="west">
 		<!--  导航内容 -->
		<ul id="treeDemo" class="ztree"></ul>
    </div>
    <div id="mainPanle" region="center" style="background: #eee; overflow-y:hidden">
        <div id="tabs" class="easyui-tabs"  fit="true" border="false">
			<div title="首页" style="padding:20px;overflow:hidden;" id="home">
				<!-- <h1>
					<c:if test="${INS_CN_NM != null}">
			        	<c:out value="${INS_CN_NM}"></c:out>
		        	</c:if>
				</h1> -->
				<div style="width: 40%;height:100%;float: left;border-right: 1px solid #95B8E7;">
					<h2>通知公告</h2>
					<table style="width: 100%;">
						<c:if test="${notices != null}">
							<c:forEach items="${notices}" var="notice" varStatus="status">
								<tr>
									<td>${status.index + 1}. <a title="点击查看详情" href="javascript:;" onclick="detailNotice('${notice.NOTICE_UUID}')">${notice.NOTICE_TITLE}</a></td>
									<td>${notice.SEND_TIME}</td>
								</tr>
							</c:forEach>
						</c:if>
					</table>
				</div>
				<div style="width: 55%;height:100%;float: right;">
					<h2>通知公告详情</h2>
					<div style="text-align: center;font-size: 16px;font-weight: bold;" id="NOTICE_TITLE">${notice.NOTICE_TITLE}</div>
					<div style="text-align: right;padding: 20px">
						<span>发布者: <span id="REC_UPD_USR_ID">${notice.REC_UPD_USR_ID}</span></span>
						<span style="margin-left: 20px">时     间: <span id="SEND_TIME">${notice.SEND_TIME}</span></span>
					</div>
					<div style="padding: 10px" id="NOTICE_CONTENT">${notice.NOTICE_CONTENT}</div>
				</div>
			</div>
		</div>
    </div> 

	<div id="mm" class="easyui-menu" style="width:150px;">
		<div id="mm-tabclose">关闭</div>
		<div id="mm-tabcloseall">全部关闭</div>
		<div id="mm-tabcloseother">关闭其他标签页</div>
		<div class="menu-sep"></div>
		<div id="mm-tabcloseright">关闭右侧标签页</div>
		<div id="mm-tabcloseleft">关闭左侧标签页</div> 
	</div>
	<div id="loginpwd"></div>
</body>
<script type="text/javascript">
	$(function(){
		/*修改密码*/
		$("#editpass").click(function(){
			$("#loginpwd").jpwin({href: "${pageContext.request.contextPath}/userlogin/modifyLoginPwd.do", width: 400, height: 250}, callback);
		});
		/*退出登陆*/
		$("#loginOut").click(function(){
// 			$.extend($.messager.defaults, {ok: "确定", cancel: "取消"});
			$.messager.confirm("确认信息", "确认退出登陆吗？", function(result){
				if(result){
					window.location.href = "${pageContext.request.contextPath}/userlogin/loginOut.do";
				}
			});
		});
		/*确定按钮回调*/
		function callback(){
			if(!$("#userPwdForm").form("validate")){
				return false;
			};
			var isSuccess = false;
			$("#userPwdForm").form("submit", {
				url: "${pageContext.request.contextPath}/userlogin/modifyPwd.do",
				success: function(data){
					data = eval('(' + data + ')');
					if(data.respCode !== "SYS_000"){
						$.messager.alert("错误提示", data.respMsg, "error");
					}else{
						isSuccess = true;
						$.messager.alert("信息提示", "登陆密码修改成功，请重新登陆", "info", function(){
							window.location.href = "${pageContext.request.contextPath}";
						});
					}
				}
			});
			return isSuccess;
		}
	});
	var oldUuid = "${notice.NOTICE_UUID}";
	/*获取公告详情*/
	function detailNotice(uuid){
		if(!uuid || oldUuid === uuid){
			return;
		}
		$.jpajax({
			url: "${pageContext.request.contextPath}/notice/detailNotice.do",
			data: {uuid: uuid},
			success: function(data){
				if(data){
					for(var key in data){
						$("#" + key).text(data[key]);
					}
					oldUuid = uuid;
				}
			}
		});
	}
</script>
</html>